<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>微信秒杀管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>

<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="sys.user.edit"><li><a href="${ctx}/wechat/seckillConfig/">秒杀配置列表</a></li></shiro:hasPermission>
		<li><a href="${ctx}/wechat/seckillConfig/form?id=${seckillConfig.id}">秒杀配置<shiro:hasPermission name="wechat:seckillConfig:edit">${not empty seckillConfig.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:seckillConfig:edit">查看</shiro:lacksPermission></a></li>
		<li><a href="${ctx}/wechat/seckill/">秒杀奖品列表</a></li>
		<li class="active"><a href="${ctx}/wechat/seckill/form?id=${seckill.id}">秒杀奖品<shiro:hasPermission name="wechat:seckill:edit">${not empty seckill.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:seckill:edit">查看</shiro:lacksPermission></a></li>
		<li><a href="${ctx}/wechat/seckillGainer">秒杀者列表</a></li> 
	</ul><br/>
	<form:form id="inputForm" modelAttribute="seckill" action="${ctx}/wechat/seckill/save" method="post" class="form-horizontal" enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="user.id"/>
		<input type="hidden" name="frequency"  value = "1"/>
		<tags:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">秒杀名称:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">秒杀价:</label>
			<div class="controls" title="请输入数字">
				<form:input path="price" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">秒杀数量:</label>
			<div class="controls" title="请输入数字">
				<form:input path="amount" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">下一次秒杀数量:</label>
			<div class="controls" title="请输入数字">
				<form:input path="nextAmount" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		
			
		<div class="control-group">
			<label class="control-label">是否发布:</label>
			<div class="controls">
				<input type="radio" name="pubFlag" value="0"> 否  &nbsp;<input type="radio"  name="pubFlag" value="1" checked="checked"> 是
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">是否重复:</label>
			<div class="controls">
				<input type="radio" name="repeats" value="0"> 否  &nbsp;<input type="radio"  name="repeats" value="1" checked="checked"> 是
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">开始时间:</label>
			<div class="controls">
				<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
					<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${seckill.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">结束时间:</label>
			<div class="controls">
				   
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${seckill.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">Logo:</label>
			<div class="controls">
				<c:if test="${seckill.logo ne '' }">
					<div class="control"><img src="${ctxUser }/seckill/${seckill.logo }" style="width:300px;height:100px"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="logofile" htmlEscape="false"   />    <span class="alert">大图片建议尺寸：720像素 * 400像素;  小图片建议尺寸：400像素 * 400像素 </span>      
				</div>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">奖品图片:</label>
			<div class="controls">
				<c:if test="${seckill.picPath ne '' }">
					<div class="control"><img src="${ctxUser }/seckill/${seckill.picPath }" style="width:300px;height:100px"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="picfile"  />    <span class="alert">大图片建议尺寸：720像素 * 400像素;  小图片建议尺寸：400像素 * 400像素 </span>      
				</div>
			</div>
		</div>
			
		
	
		<div class="control-group">
			<label class="control-label">秒杀描述:</label>
			<div class="controls">
				<form:textarea path="remarks" cols="20" rows="5"/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="wechat:seckill:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>

</html>
